package keke;


import java.util.LinkedList;
import java.util.Queue;
import java.util.Scanner;

public class Main0506 {
	public static void main(String[] args) {
        Scanner in=new Scanner(System.in);
        int i;
        int n=in.nextInt();
        Queue<Integer>A=new LinkedList<Integer>();
        Queue<Integer>B=new LinkedList<Integer>();
        Queue<Integer>C=new LinkedList<Integer>();
        for(i = 0; i < n; i++){
        	int temp=in.nextInt();
        	if((temp%2)!=0)
        		A.add(temp);
        	else
        		B.add(temp);
        }
        for(i=0;i<n;i++){
        	for(int j=0;j<2;j++){
        		if(!A.isEmpty())
        			C.add(A.poll());
        	}
        	if(!B.isEmpty())
    			C.add(B.poll());
        }
        for(i=0;i<n-1;i++)
        	System.out.print(C.poll()+" ");
        System.out.print(C.poll());
    }
}
